#ifndef REPLAY_CONTROLLER_H
#define REPLAY_CONTROLLER_H

class ReplayController;

#include <ios>
#include <cstring>
#include "Replay.h"
#include "InputDevice.h"
#include "Ball.h"
#include "PlayState.h"

/*
 * Class to handle the control of a player/ball based on a recorded replay
 */
class ReplayController : public Replay, public InputDevice
{
public:
    ReplayController(std::string);
    ReplayController(std::vector<GravityState>);
   ~ReplayController();
    void setPlayState(PlayState *rs) { replay_state = rs; }
    bool ogreNewtNeedsUpdate(Ogre::Real time_since_last);
    float getOgreNewtUpdateTime();
    void reset(); 
private:
    PlayState *replay_state;
    void load(std::string);
    void start();
    void updateBall(Ogre::Real time);
    bool registerBall(Ball *);
    void unregisterBall();
    bool recording;
    int playbackIndex;
    float total_time;
};

#endif
